package com.luhe.musicxml;

import com.luhe.musicscore.painter.localfont.LocalFontScorePartwisePainter;
import com.luhe.musicxml.v1.ScorePartwise;
import com.luhe.musicxml.v1.partlist.PartList;
import com.luhe.musicxml.v1.partlist.scorepart.partName.PartName;
import com.luhe.musicxml.v1.partlist.scorepart.ScorePart;
import com.luhe.musicxml.v1.work.Work;
import com.luhe.musicxml.v1.work.workTitle.WorkTitle;

import javax.swing.*;
import java.awt.*;


public class Run  {
    public static void main(String[] args) throws  Exception ,NoSuchFieldException, IllegalAccessException {

        //创建乐谱
        ScorePartwise scorePartwise = new ScorePartwise();

        //工作空间
        Work work = new Work(new WorkTitle("测试乐谱"));

        //声部信息
        PartList partList = new PartList();
        ScorePart scorePart = new ScorePart("1", new PartName("声部1"));
        partList.scorePartList.add(scorePart);

        scorePartwise.work = work;
        scorePartwise.partList = partList;

        //绘图对象
        LocalFontScorePartwisePainter localFontScorePartwisePainter=new LocalFontScorePartwisePainter();
        localFontScorePartwisePainter.scorePartwise=scorePartwise;

        //显示
        JFrame jFrame=new JFrame();
        jFrame.setBounds(0,0,600,600);
        jFrame.setVisible(true);
        while (true){
            Graphics graphics = jFrame.getContentPane().getGraphics();
            localFontScorePartwisePainter.paint(graphics);
            Thread.sleep(100);
        }








    }
}
